package com.xxn.springdemotest.dao;

import com.xxn.springdemotest.entity.NarutoRelation;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface RelationshipRepository extends Neo4jRepository<NarutoRelation,Long> {

    @Query("MATCH (m:naruto {name::#{#from}}),(n:naruto {name::#{#to}})" +
            "CREATE (m)-[:narutoRelation{relation::#{#relation}}]->(n)")
    void createRelation(@Param("from")String from, @Param("relation")String relation, @Param("to")String to);
}
